import {defineComponent} from "vue";
import {useRoute} from "vue-router";
import {NoticesStore} from "@/stores/notices";
import {storeToRefs} from "pinia";

import style from "./css/index.module.css"
import {formatDateTime} from "@/utils/utils";
export default defineComponent({
    setup(){
        const {id} = useRoute().query

        const notices_store = NoticesStore()
        const {noticesInfo} = storeToRefs(notices_store)

        notices_store.getNoticesInfo(id)

        return () => {
            return <>
                <div className={style.container}>
                    <div className={style.notice_title}>{noticesInfo.value.notice_title}</div>
                    <div className={style.bottom_box}>
                        <div className={style.time}>{formatDateTime(noticesInfo.value.createdAt)}</div>
                        <div>
                            <div className={style.icons}>
                                {/*<div className={style.zan}>*/}
                                {/*    <span>点赞数：</span>*/}
                                {/*    <span>1</span>*/}
                                {/*</div>*/}
                                <div className={style.zan}>
                                    <span>点击数：</span>
                                    <span>{noticesInfo.value?.record_info?.view}</span>
                                </div>
                            </div>
                            {/*<div className={style.btns}>*/}
                            {/*    <div className={style.btn} onClick={handleCollect}>收藏</div>*/}
                            {/*    <div className={style.btn} onClick = {handleLike}>点赞</div>*/}
                            {/*</div>*/}
                        </div>
                    </div>
                    <div v-html={noticesInfo.value.notice_content}></div>
                </div>
            </>
        }
    }
})